<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link type="text/css" rel="Stylesheet" href="${path}/css/common/jquery-ui-1.9.2.custom.css" />
<link type="text/css" rel="Stylesheet" href="${path}/css/common/flexigrid.css" />
<link type="text/css" rel="Stylesheet" href="${path}/css/common/style.css" />
<link type="text/css" rel="stylesheet" href="${path}/css/common/alert.css" />
<link type="text/css" rel="stylesheet" href="${path}/css/tip-yellow/tip-yellow.css" />

<script type="text/javascript" src="${path}/js/common/jquery-1.8.2.js"></script>
<script type="text/javascript" src="${path}/js/common/jquery-ui-1.8.23.custom.min-update.js"></script>
<script type="text/javascript" src="${path}/js/common/timepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="${path}/js/common/timepicker/jquery-ui-timepicker-zh-CN.js"></script>
<script type="text/javascript" src="${path}/js/common/common.js"></script>
<script type="text/javascript" src="${path}/js/common/jquery.alert.js"></script>

<script type="text/javascript" src="${path}/js/common/jquery.validate.js"></script>
<script type="text/javascript" src="${path}/js/common/messages_zh.js"></script>
<script type="text/javascript" src="${path}/js/common/jquery.metadata.js"></script>
<script type="text/javascript" src="${path}/js/common/jquery.poshytip.js"></script>
<script type="text/javascript" src="${path}/js/common/previewImg.js"></script>

<script type="text/javascript" src="${path}/js/common/jquery.cookie.js"></script>
<script type="text/javascript" src="${path}/js/common/flexigrid.js"></script>
<script type="text/javascript" src="${path}/js/temp/permissionInit.jsp"></script>
<!-- jiayu : this uri have a 404 not found -->
<%-- <script type="text/javascript" src="${path}/js/temp/advertisement/advertisementInit.jsp"></script> --%>
<script type="text/javascript" src="${path}/js/temp/bannerInit.jsp"></script>
<style type="text/css">
	label.error {border:none;}
</style>
</head>
<body>
	<%-- dialog弹出层的所有div--%>
	<c:import url="/mc/dialogDiv.jsp"></c:import>
	<div class="detail">
		<c:choose>
			<%-- 没有指定info页面，使用默认的showInfo.jsp--%>
			<c:when test="${empty param.infoPage}">
				<c:import url="/${param.modulePath}/showInfo.jsp"></c:import>
			</c:when>
			<%-- 使用指定的info页面--%>
			<c:otherwise>
				<c:import url="/${param.modulePath}/${param.infoPage}"></c:import>
			</c:otherwise>
		</c:choose>
		<div style="display: none;"><iframe width="0" height="0" name="hiddenFrame" ></iframe></div>
	</div>
</body>
</html>
<script type="text/javascript">
	$(function(){
		$("#infoForm").validate({ignore: []});
		//设置内嵌flexigrid的隐藏域id
		<c:forEach var="infoFlexVo" items="${infoFlexVoList}">
			<c:forEach var="checkedId" items="${infoFlexVo.checkedIdList}">
				$("#infoForm").prepend("<input class='hidMix' type='hidden' name='${infoFlexVo.name}' value='${checkedId}' />");
			</c:forEach>
		</c:forEach>
		
		<c:if test="${!empty param.detailTblId && !empty param.detailModule}">
			var tableIds = '${param.detailTblId}'.split(","); //拆分表格id
			var modules = '${param.detailModule}'.split(","); //拆分模块名
			if(tableIds.length === modules.length) {
				for(var i = 0; i < tableIds.length; i++) {
					$('#' + tableIds[i]).flexigrid(eval(modules[i]));
				}
			}
		</c:if>
		previewImage($("#uploadFile1").get(0), 'filehead1','fileview1');
	});

	var pt;
	var targetDialogId; //目标弹出窗的id
	var targetReload; //标识是否需要重新加载列表
	var targetHideUpdatedTr; //标识是否需要删除已经被更新的记录
	var form;
	function mySave(t, dialogId, reload, hideUpdatedTr){
		pt = t;
		targetDialogId = dialogId; //有指定目标弹出窗id的情况，进行获取
		targetReload = reload;
		targetHideUpdatedTr = hideUpdatedTr;
		form = $('#infoForm');
		form.submit();
	}
	
	function refreshParent($data){
		if(!$data.resultCode){
			hiAlert($data.errorMessage,"提示");
		}else{
			//如果设置了重新加载列表，进行加载
			if(targetReload) {
				pt.flexReload();
			}
			//如果设置了需要删除已经被更新的记录，进行数据行删除
			if(targetHideUpdatedTr) {
				$(":checkbox[value='" + $data.id + "']", pt).parents("tr").remove();
			}
			window.parent.closedetail(targetDialogId); //关闭信息窗口
		}			
	}
	
	function sysErrorShow(msg){
		if(msg != "") {
			hiAlert(msg,"提示");
		} else {
			hiAlert('服务器端验证数据失败！',"提示");
		}
	}
</script>